package com.hqyj.controller;


import com.hqyj.pojo.Purchase;
import com.hqyj.service.IPurchaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;
import java.util.HashMap;

/**
 * <p>
 * 进货表 前端控制器
 * </p>
 *
 * @author rock
 * @since 2021-10-21
 */
@RestController
@RequestMapping("/purchase")
public class PurchaseController {
    //注入StoreHouseService
    @Autowired(required = false)
    IPurchaseService purchaseService;
    //加载库存页面
    @RequestMapping("/purchaseList")
    public HashMap<String,Object> storehouseList(Purchase purchase){
        return purchaseService.select(purchase);
    }

    //新增
    @RequestMapping("/add")
    public HashMap<String ,Object> add(Purchase purchase){
        System.out.println(purchase);
        return purchaseService.add(purchase);
    }

    //入库
    @RequestMapping("/goWarehouse")
    public HashMap<String ,Object> goWarehouse(Purchase purchase, HttpSession session){
        System.out.println("goWarehouse:"+purchase);
        return purchaseService.goWarehouse(purchase,session);
    }

    //退货
    @RequestMapping("/returnedGoods")
    public HashMap<String ,Object> returnedGoods(Purchase purchase, HttpSession session){
        System.out.println("returnedGoods:"+purchase);
        return purchaseService.returnedGoods(purchase,session);
    }

}

